#include "open_interface.h"
#include "lcd.h"
#include "util.h"
#include <stdio.h>
#include <string.h>

void mai(void) {
	lcd_init();
	
	//oi_set_wheels(100, 100);
	oi_t *sensor_data = oi_alloc();
	oi_init(sensor_data);
	uint16_t cliff_frontleft_signal = sensor_data->cliff_frontleft_signal;
	uint16_t cliff_frontright_signal = sensor_data->cliff_frontright_signal;
	uint16_t cliff_left_signal = sensor_data->cliff_left_signal;
	uint16_t cliff_right_signal = sensor_data->cliff_right_signal;
	
	while(1) {
	//oi_set_wheels(100, 100);
	oi_update(sensor_data);
	cliff_frontleft_signal = sensor_data->cliff_frontleft_signal;			//Frontleft_signal  floor: 146  white: 365 cliff: 0
								
			
	cliff_frontright_signal = sensor_data->cliff_frontright_signal;			
	
			
	cliff_left_signal = sensor_data->cliff_left_signal;
	
	
	cliff_right_signal = sensor_data->cliff_right_signal;

	lprintf("%d",cliff_left_signal);
				
	}
	oi_free(sensor_data);
}		